package com.yuexinduo.education.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuexinduo.education.R;
import com.yuexinduo.baselibrary.base.BaseMvpActivity;
import com.yuexinduo.education.dialog.PayBindingDialog;

public class OutMoneyTwoActivity extends BaseMvpActivity implements View.OnClickListener,PayBindingDialog.OnClickListener {
    private ImageView back;
    private TextView top;
    private TextView outOneBinging;
    private TextView outTwoBinging;
    private PayBindingDialog payBindingDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected int bindLayout() {
        return R.layout.activity_out_money_two;
    }

    @Override
    protected Activity getActivity() {
        return this;
    }

    @Override
    protected void initCreate() {

        back = (ImageView) findViewById(R.id.back);
        top = (TextView) findViewById(R.id.top);
        outOneBinging = (TextView) findViewById(R.id.out_one_binging);
        outTwoBinging = (TextView) findViewById(R.id.out_two_binging);
        top.setText("提现");
        back.setOnClickListener(this);
        outOneBinging.setOnClickListener(this);
        outTwoBinging.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back:
                finish();
                break;
            case R.id.out_one_binging:
            case R.id.out_two_binging:
                showDialog();
                break;
        }
    }

    private void showDialog() {
        if (payBindingDialog !=null&& payBindingDialog.isShowing()){
            return;
        }
        payBindingDialog = new PayBindingDialog(getActivity(),R.style.dialog,1);
        payBindingDialog.setCanceledOnTouchOutside(true);
        payBindingDialog.setCancelable(true);
        payBindingDialog.show();
        payBindingDialog.setListener(this);
        Window window = payBindingDialog.getWindow();
        window.setGravity(Gravity.BOTTOM);
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        window.setBackgroundDrawable(getDrawable(R.color.gray));
    }

    @Override
    public void onListener() {
         startActivity(new Intent(getActivity(),LoginActivity.class));
    }
}